import 'package:boss/ui/page/index/model/bottom_navigation.dart';
import 'package:boss/ui/page/index/widget/custom_bottom_navigation_bar.dart';
import 'package:boss/ui/widget/center_title_app_bar.dart';
import 'package:flutter/material.dart';
import 'package:hi_common/hi_common.dart';
import 'package:router/annotation.dart';

import 'page/classificationDetail/classification_detail_page.dart';
import 'page/classificationSort/classification_sort_page.dart';
import 'widget/classification_management_list.dart';

@RouterConfig(ClassificationManagementPage.pageName)
class ClassificationManagementPage extends StatefulWidget {
  static const pageName = '/classificationManagementPage';

  @override
  _ClassificationManagementPageState createState() => _ClassificationManagementPageState('菜品分类管理');
}

class _ClassificationManagementPageState extends BaseState<ClassificationManagementPage> {
  List<String> _routes = [
    ClassificationSortPage.pageName,
    ClassificationDetailPage.pageName,
  ];

  _ClassificationManagementPageState(String pageName) : super(pageName);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: CenterTitleAppBar(
        title: '分类管理',
      ),
      body: ClassificationManagementList(),
      bottomNavigationBar: CustomBottomNavigationBar(
        selectedIndex: -1,
        onSelectChanged: (index) {
          Navigator.pushNamed(context, _routes[index]);
        },
        items: [
          BottomNavigation(title: '排序', icon: 'assets/image/sort_icon.png'),
          BottomNavigation(title: '新增', icon: 'assets/image/plus_light_icon.png'),
        ],
      ),
    );
  }
}
